package com.xlkj.ms.tools.core.response;

/**
 * <pre>
 * {@code
 * {
 *     "status":true,
 *     "code":"***",
 *     "msg":"****",
 *     "data":{***}
 * }
 * }
 * </pre>
 * @author zhuqifeng
 * @date 2021/11/10 13:58
 * @package com.xlkj.ms.tools.core.response
 */
public abstract class AbstractWithStatusResponse<T> extends AbstractResponseWrapper<T> {

    private static final long serialVersionUID = 2394798817962355282L;

    private boolean status;

    public AbstractWithStatusResponse() {
    }

    public AbstractWithStatusResponse(T data, boolean status) {
        super(data);
        this.status = status;
    }

    @Override
    public void wrapperSuccess() {
        this.status = true;
        super.wrapperSuccess();
    }

    @Override
    public void wrapperSystemError() {
        this.status = false;
        super.wrapperSystemError();
    }

    @Override
    public void wrapperIllegalArgument(String... illegalArguments) {
        this.status = false;
        super.wrapperIllegalArgument(illegalArguments);
    }

    @Override
    public void wrapperBizFailed(String code, String msg) {
        this.status = false;
        super.wrapperBizFailed(code, msg);
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }
}